package com.asura.app.wechat.repository;

import com.asura.app.library.utils.ExecutorHelper;
import com.asura.app.wechat.common.WechatModuleProvider;
import com.asura.app.wechat.repository.datasource.UserInfoDataSource;
import com.asura.app.wechat.repository.model.UserInfo;
import com.asura.app.wechat.repository.net.WechatApi;

import io.reactivex.Single;
import io.reactivex.schedulers.Schedulers;

/**
 * Created by Asura on 2017/12/29.
 */

public class UserInfoRemoteDataSource implements UserInfoDataSource {
    private final WechatApi wechatApi;
    public UserInfoRemoteDataSource() {
        wechatApi = WechatModuleProvider.getInstance().getWechatApi();
    }

    @Override
    public Single<UserInfo> getUserInfo() {
        return wechatApi.fetchUserInfo().subscribeOn(Schedulers.from(ExecutorHelper.HIGH));
    }
}
